<template>
  <div id="app">
    <p>测试扫一扫</p>
    <!-- 扫一扫按钮 -->
    <button @click="handleClick" >扫一扫</button>
  </div>
</template>

<script>
export default {
  name: 'App',
  el: '#app',
  methods: {
    handleClick: function () {
      // 扫一扫方法
      cordova.plugins.barcodeScanner.scan(
        function (result) {
          alert("We got a barcode\n" +
            "Result: " + result.text + "\n" +
            "Format: " + result.format + "\n" +
            "Cancelled: " + result.cancelled)
        },
        function (error) {
          alert(error)
        }
      )
    }
  }
}
</script>
